package com.pizza.gui.panele;

import java.util.ArrayList;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.ScrollPaneConstants;

import com.pizza.gui.AdapterList;
import com.pizza.gui.PizzaAdapterList;
import com.pizza.spring.rmi.Adres;
import com.pizza.spring.rmi.Produkt;
import com.pizza.spring.rmi.User;
import com.pizza.spring.rmi.start.StartClient;



public class ProduktyPanel extends JPanel{
	JScrollPane scrollPane = new JScrollPane();
	
	private ArrayList<Produkt> pizzaList = new ArrayList<Produkt>();
	private PizzaAdapterList pizzaAdapter =null;
	public JScrollPane getScrollPane() {
		return scrollPane;
	}
	User user;
	Adres adres;
	
	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public Adres getAdres() {
		return adres;
	}

	public void setAdres(Adres adres) {
		this.adres = adres;
	}

	public ProduktyPanel(JFrame frame) {
		setBounds(150, 0, 450, 400);
		setVisible(false);
		 scrollPane.setHorizontalScrollBarPolicy(
		            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
		    scrollPane.setVerticalScrollBarPolicy(
		            ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
		frame.getContentPane().add(scrollPane);
		
		
		pizzaList=StartClient.fasada.pobierzWszystkieProdukty();
		setBounds(150, 0, 450, 400);
		scrollPane.setVisible(false);
		AdapterList adapter =new AdapterList(300,100,pizzaList);
		adapter.addPizzaRowProducts(pizzaList);
//		adapter.setUser(PizzaFram.user);
//		adapter.setAdres(PizzaFram.adres);
//		adapter.setAdresZamowienia("kijowska adres pozniej przeniose to na "
//				+ "koszyk wywolanie i bedzie adres "
//				+ "okienko");
		adapter.setBounds(150, 0, 450, 400);
		scrollPane.setBounds(150, 0, 435, 400);
		adapter.setVisible(true);
		scrollPane.setViewportView(adapter);
	}
}
